// Polynomial Root-Finder
// Copyright (c) 2003, by Per Vognsen.
//
// This software is free for any use.

//#include "rootfinder.cpp"

//namespace rootfinder
//{
	template<typename T> int sign(T x);
	bool is_zero(double x);
	std::vector<double> differentiate(const std::vector<double>& coeff);
	double evaluate(const std::vector<double>& coeff, double x);
	double finite_bisect(const std::vector<double>& coeff, double low,
		                 double high);
	double bisect(const std::vector<double>& coeff, double low, double high);
	// Generate the quadratic polynomial with roots a and b.
	std::vector<double> quadratic_polynomial(double a, double b);
	// Generate the cubic polynomial with roots a, b and c.
	std::vector<double> cubic_polynomial(double a, double b, double c);
	// Generate the quartic polynomial with roots a, b, c and d.
	std::vector<double> quartic_polynomial(double a, double b, double c,
		                                   double d);
	double random_double(double low, double high);
	int random_integer(int low, int high);
	std::vector<double> random_polynomial(unsigned int degree, double low, double high);
//}

std::vector<double> find_roots(const std::vector<double>& coeff);
void test_polynomial(std::vector<double> coeff);
